import axios from "axios";

let http  = axios.create({
    timeout:10000,
    baseURL:"http://127.0.0.1:7001",
})

//请求拦截器
http.interceptors.request.use(config=>{
    const token = localStorage.getItem('token')
    if(token){
      config.headers.authorization = token
    }
    return config
},err=>{
    return Promise.reject(err)
})

//响应拦截器
http.interceptors.response.use(data=>{
    return data
},err=>{
    return Promise.reject(err)
})

export default http